function [] = piecewise_polynomial_approximation_tb()
    input_width = 10;
    lut_width = 8;
    fprintf('\tCalculating piecewise polynomial approximation, please wait for graph to appear...\n');
    fprintf('\tCalculating using %d bit LUT to store the coefficients.\n',lut_width);
    [F,X,X1,X2,X3,X4,Y1,Y2,Y3,Y4] = piecewise_polynomial_approximation(input_width,lut_width);
    
    figure;
    % plot orginal
    plot(X,F,'k--');
    hold on;
    
    % plot segments
    plot(X1,Y1,'b');
    hold on;
    plot(X2,Y2,'g');
    hold on;
    plot(X3,Y3,'r');
    hold on;
    plot(X4,Y4,'c');
    hold off
    title('Piecewise polynomial approximation');
end

